package com.yusys.thread;

import com.yusys.method.T;

import java.io.File;
import java.io.IOException;
import java.util.concurrent.*;

public class Thread05 {

    //    public static void main(String[] args) {
////        T t = new T();
////        t.setName("自定义线程");
////        t.setPriority(Thread.MIN_PRIORITY);
////        t.start();
//        /**
//         * 参数信息：
//         * int corePoolSize     核心线程大小
//         * int maximumPoolSize  线程池最大容量大小
//         * long keepAliveTime   线程空闲时，线程存活的时间
//         * TimeUnit unit        时间单位
//         * BlockingQueue<Runnable> workQueue  任务队列。一个阻塞队列
//         */
//        ExecutorService executorService = new ThreadPoolExecutor(3, 5, 1L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(4), Executors.defaultThreadFactory());
//        for (int i = 0; i < 7; i++) {
//            executorService.execute(() -> {
//                System.out.println(Thread.currentThread().getName() + " " + "--->办理业务");
//            });
//        }
//        executorService.shutdown();
//    }
    public static void main(String[] args) {
        ProcessBuilder pb = new ProcessBuilder("./" + "RUNNING_SHELL_FILE", "param1",
                "param2", "param3");
        pb.directory(new File("SHELL_FILE_DIR"));
        int runningStatus = 0;
        String s = null;
        try {
            Process p = pb.start();
            try {
                runningStatus = p.waitFor();
            } catch (InterruptedException e) {
            }

        } catch (IOException e) {
        }
        if (runningStatus != 0) {
        }
        return;
    }

}
